package cn.uestc.labhms.modules.hms.controller;

import cn.uestc.labhms.common.annotation.SysLog;
import cn.uestc.labhms.common.utils.R;
import cn.uestc.labhms.modules.hms.entity.Vo.RevisePasswordVo;
import cn.uestc.labhms.modules.hms.service.PasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
public class PasswordController {
    @Autowired
    private PasswordService passwordService;

    @GetMapping("/put/sys_user/password")
    public R sendEmail(@RequestParam String email) {
        passwordService.sendRevisePassEmail(email);
        return R.ok("发送成功");
    }

    @PostMapping("/put/sys_user/password/code")
    public R revisePassword(@RequestBody @Validated RevisePasswordVo revisePasswordVo) {
        passwordService.RevisePassword(revisePasswordVo);
        return R.ok("修改成功");
    }
}
